package com.zcc.makingfriend;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class T {
    public static void main(String[] args) {
        UUID uuid = UUID.randomUUID();
        System.out.println(uuid);
        int[] arr = {6, 4, -3, 5, -2, -1, 0, 1, -9};
        int[] ints = changeArr(arr);
        for (int i = 0; i < ints.length; i ++) {
            System.out.print(ints[i] + "\t");
        }
        Map map = new HashMap();
    }

    public static int[] changeArr(int[] arr){
        int left = 0;
        int right = arr.length - 1;
        for (int i = 0; i < arr.length; i++) {
            if (arr[left] > 0) {
                left++;
            }
            if (arr[right] < 0) {
                right--;
            }
            if (arr[left] <= 0 && arr[right] >= 0) {
                int temp = arr[left];
                arr[left] = arr[right];
                arr[right] = temp;
            }
            if (left > right) {
                break;
            }
        }
        return arr;
    }


}
